const express = require("express");
const bodyParser = require("body-parser");

const app = express();

//解析JSON格式的中间件
const jsonParser = bodyParser.json();
//解析querystring格式的中间件
const urlencodedParser = bodyParser.urlencoded({ extended: false });

app.get("/login", (req, res) => {
  res.sendFile(__dirname + "/01.form.html");
});

app.post("/login", urlencodedParser, (req, res) => {
  console.log(req.body);
  res.send("获取用户数据");
});

app.listen(3000, () => {
  console.log("服务已启动");
});
